package com.boot.down.exception;

import com.google.common.collect.Maps;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author dell
 */
@ControllerAdvice
public class ControllerExceptionHandler {

	@ExceptionHandler(SecKillException.class)
	@ResponseBody
	@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
	public Map<String, Object> handlerSecKillException(SecKillException ex){

		Map<String, Object> result = Maps.newHashMap();

		result.put("code",ex.getCode());
		result.put("msg",ex.getMsg());
		return result;
	}

}
